<?php
/**
 * Web Home
 * @filesource
 */
/**
 * Namespace
 */
namespace plurious\apps\web\controller;
/**
 * Dependencies
 */
use framework\engine\Controller;
/**
 * Home Page Controller for the Web Context
 * 
 * Extends Controller.
 * 
 * Is the default controller in all contexts.  home/index then is the landing
 * page. 
 * 
 * @author Randy Casburn <randy@plurious.com>
 * @copyright Copyright Plurious Software, all rights reserved
 * @license MIT
 * @license http://www.opensource.org/licenses/mit-license.html
 * @link http://plurious.com/framework/documentation/classes/Front.html
 * @version 2.1
 * 
 * @uses framework\engine\Controller (extends - therefore required)
 */
class Home extends Controller {
    /**
     * Allows caching of the page
     * 
     * Do not cache dynamic content or any controller that includes the 
     * login module.
     * @var bool $isCachable
     */
    protected $isCachable = false;
    /**
     * Default method for all controllers
     * 
     * Sets up the landing page.
     */
    public function index() {
	$this->document->setTitle('Home');
	$this->document->setDescription('This is a test page.');
	$this->document->setKeywords('blah1,blah2,test page, yes page, no page, red page, blue page');
        
        $this->registry->set('page_name', 'Home');
        $this->children = array ( 'common/header', 'common/footer');
        $this->modules = array('login');
        if($this->user->isLoggedIn()){
            array_push($this->children, 'common/admin');
        }
        
        $this->render();
    }
    /**
     * Convenience method for allowing log ins from the home page.
     */
    public function login(){
        $result = $this->user->login();
        $this->index();
    }
    
    /**
     * Convenience method for allowing logouts from the home page.
     */
    public function logout(){
        $this->user->logout();
    }

}

?>
